#include<bits/stdc++.h>
using namespace std;

int main()
{
	map<char, int> mp;
	string str;
	cin >> str;
	for(int i=0; i<str.size(); i++)
	{
		mp[str[i]]++;
	}
	int max = 0;
	char x = 's';
	for(map<char, int>::iterator it=mp.begin(); it!=mp.end(); it++)
	{
		if(it->second > max)
		{
			x = it->first;
			max = it->second;
		}
		else if(it->second == max)
		{
			if((int)x > (int)it->first)
				x = it->first;
		}
	}
	cout << x << endl << max << endl;
	return 0;
}